// 函数泛型的使用
function createArray<T>(len: number, value: T) {
  const result = []
  for (let i = 0; i < len; i++) {
    result.push(value)
  }
  return result
}
const createArray2 = <T>(len: number, value: T) => {
  const result = []
  for (let i = 0; i < len; i++) {
    result.push(value)
  }
  return result
}

console.log(createArray2<string>(5, '456'))
console.log(createArray<number>(4, 11))
console.log(createArray<boolean>(3, false))
